package com.panda.common;

import com.panda.command.Console;
import org.yaml.snakeyaml.Yaml;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.Map;

 class YamlLoader {

     private static Yaml yaml = new Yaml();

     static Map load(File file) {
         InputStreamReader inputStreamReader = null;
         try {
             inputStreamReader = new InputStreamReader(new FileInputStream(file), Console.charset);
             Map r = yaml.loadAs(inputStreamReader, Map.class);
             inputStreamReader.close();
             return r;
         } catch (java.io.IOException e) {
             throw new RuntimeException(e);
         }
     }

}
